﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HANS.Common
{
    /// <summary>
    /// 通用正则表达式
    /// </summary>
     public  class Regular
    {
        /// <summary>
        /// 数字
        /// </summary>
        public const string Number = @"^[0-9]*$";

        /// <summary>
        /// 中文（汉字）
        /// </summary>
        public const string Chinese = @"^[\u4e00-\u9fa5]{0,}$";

        /// <summary>
        /// 英文和数字
        /// </summary>
        public  const string EnglishOrNumber=@"^[A-Za-z0-9]+$ 或 ^[A-Za-z0-9]{4,40}$";

        /// <summary>
        /// Email地址
        /// </summary>
        public const string Email = @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$";

        /// <summary>
        /// 域名
        /// </summary>
        public const string DomainName = @"[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?";

        /// <summary>
        /// 网站地址
        /// </summary>
        public const string NETUrl = @"[a-zA-z]+://[^\s]";

        /// <summary>
        /// 手机号码
        /// </summary>
        public const string Phone = @"^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$";

        /// <summary>
        /// 固定电话
        /// </summary>
        public const string FixedPhone = @"^($$\d{3,4}-)|\d{3.4}-)?\d{7,8}$";

        /// <summary>
        /// 国内固定电话
        /// </summary>
        public const string FixedPhoneInChina = @"\d{3}-\d{8}|\d{4}-\d{7}";

        /// <summary>
        /// 身份证号码
        /// </summary>
        public const string IDNumber = @"^\d{15}|\d{18}$";

        /// <summary>
        ///  短身份证号码（(数字、字母x结尾）
        /// </summary>
        public const string ShortIDNumber = @"^([0-9]){7,18}(x|X)?$ ";

        /// <summary>
        /// 帐号是否合法(字母开头，允许5-16字节，允许字母数字下划线)
        /// </summary>
        public const string AccountNumber = @"^[a-zA-Z][a-zA-Z0-9_]{4,15}$";

        /// <summary>
        /// 密码(以字母开头，长度在6~18之间，只能包含字母、数字和下划线)
        /// </summary>
        public const string Password = @"^[a-zA-Z]\w{5,17}$";

        /// <summary>
        /// 强密码(必须包含大小写字母和数字的组合，不能使用特殊字符，长度在8-15之间)
        /// </summary>
        public const string StrongPassword = @"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,15}$";

        /// <summary>
        /// 日期格式 2017-01-01
        /// </summary>
        public const string DateFormt = @"^\d{4}-\d{1,2}-\d{1,2}";

        /// <summary>
        /// 钱
        /// </summary>
        public const string Money = @"^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$";

        /// <summary>
        /// html标记
        /// </summary>
        public const string HtmlSign = @"<(\S*?)[^>]*>.*?</\1>|<.*? />";

        /// <summary>
        /// 腾讯QQ
        /// </summary>
        public const string QQ = @"[1-9][0-9]{4,}";
    }
}
